<?php
     header("Content-type:text/html;charset:utf-8");
     //连接数据库
     $mysqli = new mysqli("localhost","root","root","yiguoshengxian");
     //判断数据库是否连接成功

    // $page = $_GET['page'];

    $sql = "SELECT * FROM commodity";

    $result = $mysqli->query($sql);
     if ($result->num_rows > 0) {
        $data['code'] = 1;
        $data['data'] = [];
        while($row = $result->fetch_assoc()) {
            $row['prolist'] = json_decode($row['prolist'] );
            array_push($data['data'],$row);
        }
    } else {
        $data['code'] = 0;
    }



    echo json_encode($data)

?>